import request from '@/config/axios'

export interface TaskVO {
  id: number
  siteId: number
  userId: number
  name: string
  beginTime: Date
  endTime: Date
  currentNum: number
  totalNum: number
  taskType: number
  status: number
  errorMsg: string
}

// 查询任务列表
export const getTaskPage = async (params) => {
  return await request.get({ url: '/cms/task/page', params })
}

// 查询任务详情
export const getTask = async (id: number) => {
  return await request.get({ url: '/cms/task/get?id=' + id })
}

// 删除任务
export const deleteTask = async (id: number) => {
  return await request.post({ url: '/cms/task/delete?id=' + id })
}
export const deleteTasks = async (ids: number[]) => {
  return await request.post({ url: '/cms/task/deleteByIds', data: ids })
}

//生成本站点所有静态页
export const staticpageAll = async () => {
  return await request.post({ url: '/cms/content/staticpage/all' })
}
//生成本站首页静态页
export const staticpageIndex = async () => {
  return await request.post({ url: '/cms/content/staticpage/index' })
}
//生成本站包含页面静态页
export const staticpageInclude = async () => {
  return await request.post({ url: '/cms/content/staticpage/includepage' })
}
//生成本站栏目静态页
export const staticpageChannel = async () => {
  return await request.post({ url: '/cms/content/staticpage/channel' })
}
//生成本站内容静态页
export const staticpageContent = async () => {
  return await request.post({ url: '/cms/content/staticpage/content' })
}
// 导出任务 Excel
export const exportTaskApi = async (params) => {
  return await request.download({ url: '/cms/task/export-excel', params })
}
